﻿<div ng-controller="productTokenMakerController">
    <div class="wrapper border-bottom white-bg page-heading">
        <div class="col-lg-pull-12">
            <ol class="breadcrumb">
                <li><a href="javascript:void(0)" ng-click="goBack()">活动</a></li>
                <li class="active">创客商品</li>
            </ol>
        </div>
    </div>

    <form class="form-horizontal row">
        <div class="form-group">
            <div class="col-sm-3">
                <label class="col-sm-5 control-label">商品名称</label>
                <div class="col-sm-7">
                    <input name="product_name" type="text" class="form-control input-sm" ng-model="query.product_name">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <div class="col-sm-offset-4 col-sm-8">
                    <button class="btn btn-primary btn-sm" ng-click="search()"><i class="fa fa-search"></i> 查询</button>
                    <button class="btn btn-primary btn-sm" ng-click="addGood()"><i class="fa fa-plus"></i>添加</button>
                </div>
            </div>
        </div>
    </form>
    <table style="table-layout:fixed;" class="table table-hover m-t-md">
        <thead>
            <tr style="background-color: #f7f7f9;">
                <th>序号</th>
                <th>图片</th>
                <th width="100">名称 价格</th>
                <th width="100">规格</th>
                <th>所属账号</th>
                <th>库存</th>
                <th>状态</th>
                <th width="200">操作</th>
            </tr>
        </thead>
        <tbody ng-repeat="item in model.rows">
            <tr>
                <td>{{$index+1}}</td>
                <td><img ng-show="item.product_activity.product.first_image != null||item.product_activity.product.main_image_url != null" height="60" width="60" src="{{item.product_activity.product.main_image_url!=null?item.product_activity.product.main_image_url:item.product_activity.product.first_image}}" /></td>
                <td>
                    <div class="media">
                        <div class="media-body">
                            <p class="media-heading">{{item.product_activity.product.name}}</p>
                            <span>{{item.product_activity.activity_price | currency:'￥'}}</span>
                        </div>
                    </div>
                </td>
                <td>{{item.product_activity.product_sku != null ? item.product_activity.product_sku.sku_name : ''}}</td>
                <td>{{ item.product_activity.product.merchant.usertype == 2 || item.product_activity.product.merchant.usertype == 5 ? '系统' : item.product_activity.product.merchant.mobile}}</td>
                <td>{{item.product_activity.product.stock}}</td>
                <td>{{(item.product_activity.product.audit_status == 2 && item.product_activity.product.sale_status == 1) ? '上架中' : '下架'}}</td>
                <td>
                    <a class="btn btn-primary btn-xs" href="javascript:void(0);" ui-sref="app.productTokenMaker.detail({id:{{item.product_activity_id}}})"><i class="fa fa-cog"></i>修改</a>
                    <a class="btn btn-primary btn-xs" href="javascript:void(0);" ng-click="remove(item.product_activity_id)"><i class="fa fa-times"></i>删除</a>
                </td>
            </tr>
        </tbody>
    </table>
    <div class="row">
        <div class="col-md-12">
            <uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
                            ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
                            previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
            <span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
        </div>
    </div>
</div>
<script type="text/ng-template" id="modal.html">
    <p>
    <p class="modal-header"><h5 class="modal-title" align="center">商品列表</h5></p>
    <form class="form-horizontal row">
        <div class="form-group">
            <div class="col-sm-3">
                <label class="col-sm-5 control-label">商品名称</label>
                <div class="col-sm-7">
                    <input name="keyword" type="text" class="form-control input-sm" ng-model="keyword" style="width:400px">
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-4">
                <div class="col-sm-offset-4 col-sm-8">
                    <button class="btn btn-primary btn-sm" ng-click="getProducts()"><i class="fa fa-search"></i> 查询</button>
                </div>
            </div>
        </div>
     </form>
        <table class="table table-hover m-t-md">
            <thead>
                <tr>
                    <th width="50"></th>
                    <th>图片</th>
                    <th width="100">名称 价格</th>
                    <th width="300">描述</th>
                    <th width="50">库存</th>
                    <th width="50">所属账号</th>
                    <th width="100">添加时间</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="item in data.rows" id="product_tr_{{item.id}}" ng-click="selectTr(item.id)" style="cursor:pointer">
                    <td><input type="radio" name="product" value="{{item.id}}" /></td>
                    <td><img ng-show="item.first_image != null||item.main_image_url != null" height="60" width="60" src="{{item.main_image_url!=null?item.main_image_url:item.first_image}}" /></td>
                    <td>
                        <div class="media" style="width:200px;">
                            <div class="media-body">
                                <p class="media-heading">{{item.name}}</p>
                                <span>{{item.price | currency:'￥'}}</span>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;max-height:30px;width:280px;display:inline-block;">
                            {{item.short_description}}
                        </div>
                    </td>
                    <td>{{item.stock}}</td>
                    <td>{{item.merchant.usertype == 2 || item.merchant.usertype == 5 ? '系统' : item.merchant.mobile}}</td>
                    <td>{{item.create_time}}</td>
                </tr>
            </tbody>
        </table>
        <div class="row">
            <div class="col-md-10">
                <uib-pagination total-items="data.total_result" items-per-page="data.size" ng-model="data.page" num-pages="list.total_pages"
                                ng-change="search_page(data.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
                                previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
                <span class="pull-right" style="margin: 30px 0px 20px 0px">共{{data.total_result}} 当前：{{data.page}}/{{data.total_pages}}</span>
            </div>
        </div>
        </p>
        <p class="modal-footer">
            <button class="btn btn-primary" ng-click="ok()">
                确认
            </button>
            <button class="btn btn-warning" ng-click="cancel()">
                退出
            </button>
        </p>
        </p>
</script>

<style type="text/css">
    .large-Modal .modal-dialog {
        height: 500px;
        width: 1000px;
        overflow-y:auto;
        overflow-x:hidden;
        /*margin: auto;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;*/
    }
    .pop .modal-dialog {
        width: 500px;
        overflow-y: auto;
        overflow-x: hidden;
        height: 500px;
    }
    .ui-label{
        display:inline-block;
        width: 70px;
        text-align:right;
        padding: 0 10px 0 0;
        float:left;
        line-height: 30px;
    }
    .fn-hidden{
        overflow:hidden;
    }
    .popBox{
        padding: 30px
    }
</style>